home *** CD-ROM | disk | FTP | other *** search
/ HaCKeRz Kr0nlcKLeZ 1 / HaCKeRz Kr0nlcKLeZ.iso / chibacity / tdupdat2.err / MASUDKHA.ZIP / TPE12.ZIP / TPE.DOC < prev    next >
Encoding:
Text File  |  1993-12-24  |  8.7 KB  |  227 lines

  1.  
  2.  
  3.         TridenT Polymorphic Engine                       version 1.2
  4.         ============================================================
  5.  
  6.         Written by Masud Khafir of the TridenT virus research group.
  7.  
  8.  
  9.  
  10. What is it?
  11. ~~~~~~~~~~~
  12.  
  13.         The TPE is a module that can be included in programs to make
  14.         them able to produce polymorphic programs. The TPE comes as
  15.         an OBJ file. If you want to include the TPE in your program
  16.         you must link it to it. If you have never linked an object
  17.         file to a program, DON'T start with the TPE. First do this,
  18.         then return to the TPE.
  19.  
  20.         The TPE does two things. First, it will encrypt the original
  21.         code. This is done in a different way each time the TPE is
  22.         called. Second, it will generate a decryption routine for it.
  23.         The encrypted code will be put right after the decryption
  24.         routine. The size of the decryption routine will not be very
  25.         big. At most a few hundred bytes. Of course, the decryptor
  26.         will also be different each time the TPE is called. The TPE
  27.         can produce plain decryptors or decryptors with some random
  28.         non-functional instructions inserted.
  29.  
  30.         The size of the TPE is 1355 bytes; We believe this is not too
  31.         big.
  32.  
  33.  
  34. What's new?
  35. ~~~~~~~~~~~
  36.  
  37.         The previous verion 1.1 sometimes produced decryptors that
  38.         could not run on all processor types. This bug is fixed in
  39.         version 1.2. Also a few other things were changed in this
  40.         version.
  41.  
  42.  
  43. How can I use it?
  44. ~~~~~~~~~~~~~~~~~
  45.  
  46.         The TPE offers you 3 subroutines: 'rnd_init', 'rnd_get' and
  47.         'crypt'. It also can give you the addresses of the begin and
  48.         end of TPE. If you write your program in assembler, you must
  49.         include the following in your source code:
  50.  
  51.                 .model  tiny
  52.                 .code
  53.  
  54.                 extrn   rnd_init:near
  55.                 extrn   rnd_get:near
  56.                 extrn   crypt:near
  57.                 extrn   tpe_bottom:near
  58.                 extrn   tpe_top:near
  59.  
  60.         The first (rnd_init) is a subroutine to initialize the random
  61.         number generator. You are advised to call this subroutine
  62.         before the first time you call the encryption subroutine. If
  63.         you don't, the random number generator may not function
  64.         perfectly. All registers will be preserved.
  65.  
  66.         The second is a subroutine that returns a random number in AX.
  67.         This subroutine is used by TPE, but you can use it also for
  68.         other things in your program. Your imagination is the limit.
  69.         All registers, except AX, are preserved.
  70.  
  71.         The third is the actual encryption subroutine. This one needs
  72.         several input parameters. When it finishes, it will return
  73.         some output parameters. All parameters are passed in registers
  74.         (see below).
  75.  
  76.         The last two are the begin and end addresses of the TPE in
  77.         your program. You may need these if your program is going to
  78.         include the TPE in the generated program.
  79.  
  80.         You can leave out 'extrn' commands of things you don't use
  81.         in your source code. 
  82.  
  83.         Be sure that there is enough stack space for the TPE. (100
  84.         bytes appear to be enough). If you use the TPE in a resident
  85.         program, it is recomended to maintain your own stack.
  86.         Otherwise the chance is that you will blow the DOS stack.
  87.  
  88.         Of course, you must link TPE.OBJ to you program!
  89.         If you are using more than one segment in your program, the
  90.         complete TPE will be put in the CODE segment (called _TEXT). 
  91.  
  92.  
  93.  
  94. Input parameters of the crypt routine:
  95. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  96.  
  97.         ES = Work segment
  98.  
  99.             This is the place where the decryptor and the encrypted
  100.             code will be generated. Be sure that it is large enough.
  101.             It must at least be as large as the size of the code to
  102.             encrypt plus the size of the decryptor. 512 bytes plus
  103.             the length of the code ought to be enough.
  104.  
  105.         DS:DX => Code to encrypt
  106.  
  107.             This must point to the code you want to encrypt.
  108.  
  109.         CX = Length of code to encrypt
  110.  
  111.             Put the size of the piece of code you want to encrypt
  112.             in CX. The TPE cannot encrypt more than 32768 bytes,
  113.             so the value of CX must be lower.
  114.  
  115.         BP = Offset where the decryption routine will be executed
  116.  
  117.             You must put the address where the decryptor will start
  118.             in BP. For example, if the generated program will be a
  119.             COM file which starts with the decryptor, you must set
  120.             this value to 100h.
  121.  
  122.         SI = Distance between decryptor and encrypted code
  123.  
  124.             In this register you must put the distance that will be
  125.             between the decryptor and the encrypted code. If the
  126.             encrypted code will be right after the decryptor (this
  127.             is the normal case) you must set this value to 0.
  128.  
  129.         AX = Bit field
  130.  
  131.             In this register you can provide some options about the
  132.             way the decryptor must be.
  133.  
  134.             bit 0:  DS will not always be equal to CS
  135.  
  136.                 If you are not sure that DS will be equal to CS when
  137.                 the decryptor takes control, you must set this bit
  138.                 high. This is the case when the decryptor is in an
  139.                 EXE file.
  140.  
  141.             bit 1:  Insert random non-functional instructions in 
  142.                     decryptor
  143.  
  144.                 If this bit is high, the decryption routine will
  145.                 contain several non-functional instructions. Since
  146.                 these instructions are non-functional, they don't
  147.                 disturb the decryptor.
  148.  
  149.             bit 2:  Put random instructions before decryptor
  150.  
  151.                 If this bit is high, several random instructions
  152.                 are put before the decryption routine. These
  153.                 instructions may affect the registers, but they
  154.                 won't disturb the decryptor.
  155.  
  156.             bit 3:  Preserve AX with decryptor
  157.  
  158.                 If you want to preserve the original value of AX
  159.                 after decryption, you must set this bit high.
  160.  
  161.  
  162.  
  163. Output parameters of the crypt routine:
  164. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  165.  
  166.         ES = Work segment (preserved)
  167.  
  168.             ES will still point to the work segment.
  169.  
  170.         DS:DX => Decryptor + encrypted code
  171.  
  172.             This will now point to the decryptor, immediatly followed
  173.             by the encrypted code. DS:DX will be the same as ES:0000.
  174.             If SI was set to 0 before the TPE was called, the code
  175.             is now ready to be put in a file.
  176.  
  177.         CX = Length of decryptor + encrypted code
  178.  
  179.             CX now has the summary length of both the decryptor and
  180.             the encrypted code. You can use this value to write the
  181.             decryptor plus the encrypted code to a file (in case SI
  182.             was set to 0 before the TPE was called).
  183.  
  184.         DI = Length of decryptor
  185.  
  186.             If SI was not set to 0 before the TPE was called, you
  187.             will need this value when you want to write the decryptor
  188.             to a file. This value can also be used as an offset of
  189.             the encrypted code. This will be at DS:DI (because DX
  190.             will be 0). If SI was 0, you can ignore this value.
  191.  
  192.         AX = length of encrypted code
  193.  
  194.             This value will be the same as the value of CX before
  195.             the TPE was called. If SI was not set to 0 before the
  196.             TPE was called, you will need this value when you want
  197.             to write the encrypted code to a file. If SI was 0, you
  198.             can ignore this value.
  199.  
  200.         BP = Offset where the decryption routine will be (preserved)
  201.  
  202.             BP will still contain the address from where the
  203.             decryption routine must be executed.
  204.  
  205.  
  206.  
  207. Final notes.
  208. ~~~~~~~~~~~~
  209.  
  210.         First, I want to thank the Dark Avenger from Bulgaria for his
  211.         nice 'Mutation Engine' program. This fine program has been a
  212.         great source of inspiration for the TPE!
  213.  
  214.         Check out the source of TPE-GEN to learn more about the TPE
  215.         and how it works.
  216.  
  217.         Please, remember that the author of the TPE and the TridenT
  218.         virus research group are not responsible if you use the TPE
  219.         in an illegal or naughty way.        
  220.  
  221.         Good luck.
  222. 
  223. ;  ─────────────────────────────────────────────────────────────────────────
  224. ;  ───────────────> ReMeMbEr WhErE YoU sAw ThIs pHile fIrSt <───────────────
  225. ;  ───────────> ArReStEd DeVeLoPmEnT +31.77.SeCrEt H/p/A/v/AV/? <───────────
  226. ;  ─────────────────────────────────────────────────────────────────────────
  227.